// app.ts
var serverurl: string = "https://api.yun12.love"
var apiList: object = {
  article: `${serverurl}/ApiIndex/article`,
  articleContent: `${serverurl}/ApiIndex/articleContent`

}
App<IAppOption>({
  globalData: {
    serverurl: serverurl,
    apiList: apiList,
  },
  apiPost: function (url: string, data: any, callback: any) {
    var header = {
      'content-type': 'application/json;charset=UTF-8',
      "X-Requested-With": 'XMLHttpRequest',
    };
    wx.request({
      url: url,
      data: data,
      method: 'POST',
      dataType: 'json',
      header: header,
      success: (res) => {
        return callback(res.data);
      },
      fail: function (res) {
        console.log(res)
        console.error(url + '请求失败');
      },
    })
  },
  onLaunch() {
    // 展示本地存储能力
    const logs = wx.getStorageSync('logs') || []
    logs.unshift(Date.now())
    wx.setStorageSync('logs', logs)
  },
})